package com.file.system.entity.business;


import java.io.Serializable;
import java.time.LocalDate;

import cn.hutool.core.util.StrUtil;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;

import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.file.system.plugin.dict.Dict;
import com.file.system.plugin.validated.SQLInjectionValidation;
import lombok.Data;
import lombok.EqualsAndHashCode;


/**
 * 器具
 *
 * @author jch
 */
@Data
@EqualsAndHashCode
@ContentRowHeight(25)
@HeadRowHeight(35)
@ColumnWidth(25)
public class BusUtensilExcel implements Serializable {
    /**
     * 订单id
     */
    @ExcelIgnore
    private long fkIndentId;
    /**
     * 导入标识
     */
    @ExcelProperty("导入标识")
    private String index;
    /**
     * 检测类型
     */
    @ExcelProperty("业务类型")
    private String dictReportType;
    /**
     * 器具名称
     */
    @ExcelProperty("器具名称")
    private String sampleName;
    /**
     * 委托单位名称/发票单位名称
     */
    @ExcelProperty("委托单位")
    private String nameOfEntrustOrg;
    /**
     * 证书单位名称
     */
    @ExcelProperty("证书单位")
    private String certificationCompany;
    /**
     * 器具种类
     */
    @ExcelProperty("器具种类")
    private String dictEquipmentType;
    /**
     * 型号规格
     */
    @ExcelProperty("规格型号")
    private String specModel;
    /**
     * 制造厂家
     */
    @ExcelProperty("制造单位")
    private String applianceManufacturer;
    /**
     * 出厂编号
     */
    @ExcelProperty("出厂编号")
    private String sampleFactoryNumber;
    /**
     * 数量单位
     */
    @ExcelProperty("数量单位")
    private String dictAAUs;
    /**
     * 器具来源 下厂 送检
     * todo:前表赋值
     */
    @ExcelProperty("器具来源")
    private String dictCheckType;
    /**
     * 器具状态
     */
    @ExcelProperty("器具状态")
    private String dictApplianceStatus;
    /**
     * 强制检定
     */
    @ExcelProperty("强制检定")
    private String dictVerification;
    /**
     * 法定类别
     */
    @ExcelProperty("法定类别")
    private String dictLegalCategory;
    /**
     * 取证书方式
     */
    @ExcelProperty("取证书方式")
    private String dictCertificateMethod;
    /**
     * 主检科室
     */
    @ExcelProperty("主检科室")
    private String dictTestDepartment;
    /**
     * 专业
     */
    @ExcelProperty("专业")
    private String dictSpeciality;
    /**
     * 主检人
     */
    @ExcelProperty("主检人")
    private String principalInspector;
    /**
     * 委托日期
     * todo:前表赋值
     */
    @ExcelProperty("委托日期")
    private LocalDate entrustDate;
    /**
     * 检定需时
     */
    @ExcelProperty("检定需时")
    private String verificationTimeRequired;
    /**
     * 商定完成日期
     */
    @ExcelProperty("商定完成日期")
    private String agreedCompletionDate;
    /**
     * 受理人员
     */
    @ExcelProperty("受理人")
    private String accepterSign;

    //------------------------------------------------------------------------------------------------------------

    public void setDictEquipmentType(String dictEquipmentType) {
        if (StrUtil.isEmpty(dictEquipmentType)) {
            return;
        }
        switch (dictEquipmentType) {
            case "length":
                this.dictEquipmentType = "长度";
                break;
            case "mechanics":
                this.dictEquipmentType = "力学";
                break;
            case "acoustics":
                this.dictEquipmentType = "力学";
                break;
            case "temperature":
                this.dictEquipmentType = "温度";
                break;
            case "electromagnetism":
                this.dictEquipmentType = "电磁";
                break;
            case "radio":
                this.dictEquipmentType = "无线电";
                break;
            case "time":
                this.dictEquipmentType = "时间频率";
                break;
            case "ionizingRadiation":
                this.dictEquipmentType = "电离辐射";
                break;
            case "chemistry":
                this.dictEquipmentType = "化学";
                break;
            case "optics":
                this.dictEquipmentType = "光学";
                break;
            case "specialPurpose":
                this.dictEquipmentType = "专用";
                break;
            default:
                break;
        }
    }

    public void setDictAAUs(String dictAAUs) {
        if (StrUtil.isEmpty(dictAAUs)) {
            return;
        }
        switch (dictAAUs) {
            case "tower":
                this.dictAAUs = "台";
                break;
            case "cover":
                this.dictAAUs = "套";
                break;
            case "part":
                this.dictAAUs = "部";
                break;
            case "individual":
                this.dictAAUs = "个";
                break;
            case "piece":
                this.dictAAUs = "件";
                break;
            case "box":
                this.dictAAUs = "箱";
                break;
            case "branch":
                this.dictAAUs = "支";
                break;
            case "strip":
                this.dictAAUs = "条";
                break;
            default:
                break;
        }
    }

    public void setDictTestDepartment(String dictTestDepartment) {
        if (StrUtil.isEmpty(dictTestDepartment)) {
            return;
        }
        switch (dictTestDepartment) {
            case "lengthAndTrafficMeasurementRoom":
                this.dictTestDepartment = "长度与交通计量室";
                break;
            case "flowMeteringRoom":
                this.dictTestDepartment = "流量计量室";
                break;
            case "commodityQuantityMeasurementRoom":
                this.dictTestDepartment = "商品量计量室";
                break;
            case "biochemistryAndMedicalDeviceTestingRoom":
                this.dictTestDepartment = "生物化学与医疗器械检测室";
                break;
            case "mechanicalMetrologyRoom":
                this.dictTestDepartment = "力学计量室";
                break;
            case "temperatureAndElectromagneticMeasurementRoom":
                this.dictTestDepartment = "温度与电磁计量室";
                break;
            case "mechanicalAndElectricalAndBuildingMaterialsProductInspectionRoom":
                this.dictTestDepartment = "机电与建材产品检验室";
                break;
            case "qualityInfrastructureTechnologyInnovationSubCenter":
                this.dictTestDepartment = "质量基础设施科技创新分中心";
                break;
            case "chemistryAndMedicalMetrologyRoom":
                this.dictTestDepartment = "化学与医学计量室";
                break;
            default:
                break;
        }
    }

    public void setDictReportType(String dictReportType) {
        if (StrUtil.isEmpty(dictReportType)) {
            return;
        }
        switch (dictReportType) {
            case "verification":
                this.dictReportType = "检定";
                break;
            case "calibration":
                this.dictReportType = "校准";
                break;
            case "test":
                this.dictReportType = "测试";
                break;
            default:
                break;
        }
    }


    public void setDictVerification(String dictVerification) {
        if (StrUtil.isEmpty(dictVerification)) {
            return;
        }
        switch (dictVerification) {
            case "0":
                this.dictVerification = "否";
                break;
            case "1":
                this.dictVerification = "是";
                break;
            default:
                break;
        }
    }

    public void setDictApplianceStatus(String dictApplianceStatus) {
        if (StrUtil.isEmpty(dictApplianceStatus)) {
            return;
        }
        switch (dictApplianceStatus) {
            case "invalidated":
                this.dictApplianceStatus = "报废";
                break;
            case "use":
                this.dictApplianceStatus = "在用";
                break;
            case "deactivate":
                this.dictApplianceStatus = "停用";
                break;
            default:
                break;
        }
    }

    public void setDictLegalCategory(String dictLegalCategory) {
        if (StrUtil.isEmpty(dictLegalCategory)) {
            return;
        }
        switch (dictLegalCategory) {
            case "medicalHygiene":
                this.dictLegalCategory = "医疗卫生";
                break;
            case "safetyProtection":
                this.dictLegalCategory = "安全防护";
                break;
            case "tradeSettlement":
                this.dictLegalCategory = "贸易结算";
                break;
            case "environmentalMonitoring":
                this.dictLegalCategory = "环境监测";
                break;
            default:
                break;
        }
    }

    public void setDictCertificateMethod(String dictCertificateMethod) {
        if (StrUtil.isEmpty(dictCertificateMethod)) {
            return;
        }
        switch (dictCertificateMethod) {
            case "askFor":
                this.dictCertificateMethod = "自取";
                break;
            case "mail":
                this.dictCertificateMethod = "邮寄";
                break;
            case "other":
                this.dictCertificateMethod = "其他";
                break;
            default:
                break;
        }
    }

    public void setDictSpeciality(String dictSpeciality) {
        if (StrUtil.isEmpty(dictSpeciality)) {
            return;
        }
        switch (dictSpeciality) {
            case "length":
                this.dictSpeciality = "长度";
                break;
            case "traffic":
                this.dictSpeciality = "交通";
                break;
            case "ophthalmicOptics":
                this.dictSpeciality = "眼科光学";
                break;
            case "pressure":
                this.dictSpeciality = "压力";
                break;
            case "glassContainer":
                this.dictSpeciality = "玻璃量器";
                break;
            case "quality":
                this.dictSpeciality = "质量";
                break;
            case "temperature":
                this.dictSpeciality = "温度";
                break;
            case "electricity":
                this.dictSpeciality = "电学";
                break;
            case "environment":
                this.dictSpeciality = "环境";
                break;
            case "largeScale":
                this.dictSpeciality = "大型衡器";
                break;
            case "smallScale":
                this.dictSpeciality = "中小型衡器";
                break;
            case "fillingMachine":
                this.dictSpeciality = "灌装机";
                break;
            case "productQuantity":
                this.dictSpeciality = "商品量";
                break;
            case "refueller":
                this.dictSpeciality = "加油机";
                break;
            case "gasDispenser":
                this.dictSpeciality = "加气机";
                break;
            case "gasMeter":
                this.dictSpeciality = "燃气表";
                break;
            case "flowmeter":
                this.dictSpeciality = "流量计";
                break;
            case "waterMeter":
                this.dictSpeciality = "水表";
                break;
            case "chemicalAnalysisInstruments":
                this.dictSpeciality = "化学分析仪器";
                break;
            case "medicalIntensiveExamination":
                this.dictSpeciality = "医学强检";
                break;
            case "MedicalNonMandatoryTesting":
                this.dictSpeciality = "医学非强检";
                break;
            case "largeCaliberFlowRate":
                this.dictSpeciality = "大口径流量";
                break;
            case "dynamometry":
                this.dictSpeciality = "测力";
                break;
            case "metering":
                this.dictSpeciality = "计量";
                break;
            default:
                break;
        }
    }
}
